package com.my.fragments;

import java.security.acl.Group;

import com.example.myandtest.R;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;

import android.R.bool;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

public class fgtest1 extends Fragment{
		
	private View rootView = null;
	
	@Override
	public void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState);
	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) 
	{		
		if(rootView == null)
		{
			String url = getArguments().get("url").toString();
			
			rootView = inflater.inflate(R.layout.fview,container,false);
			ImageView iv = (ImageView)rootView.findViewById(R.id.imageView1);
			
			DisplayImageOptions options = new DisplayImageOptions.Builder()
			.showImageOnLoading(R.drawable.defaultx)
			.showImageForEmptyUri(R.drawable.defaultx)
			.showImageOnFail(R.drawable.defaultx)
		//	.cacheInMemory(true)
			.cacheOnDisc(true)
			.considerExifParams(true)
			.build();
			
			ImageLoader.getInstance().displayImage(url, iv, options);
		}
		
		ViewGroup p = (ViewGroup)rootView.getParent();
		if(p != null)
		{
			p.removeAllViewsInLayout();
		}
		
		return rootView;
	}
	
}
